package com.snake.springboot.authority.service.config;

import com.snake.springboot.authority.api.model.AuthAccountModel;
import org.snake.common.utils.JsonUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 类 {@code AuthProperties}  <br> .
 * <p>服务请求接口服务实现类
 * 创建时间：2025/01/3 11:51
 * @author yxt
 * @see
 */
@Component
@ConfigurationProperties(prefix = "auth")
public class AuthProperties {

    private String cache;

    private String gatewayMqExchange;

    private String gatewayMqRoutingKey;

    private List<AuthAccountModel> accounts;

    public String chooseUrl(Integer type){
        for(AuthAccountModel account : accounts){
            if(type.equals(account.getType())){
                return account.getUrl();
            }
        }
        return null;
    }

    public String getGatewayMqRoutingKey() {
        return gatewayMqRoutingKey;
    }

    public void setGatewayMqRoutingKey(String gatewayMqRoutingKey) {
        this.gatewayMqRoutingKey = gatewayMqRoutingKey;
    }

    public String getGatewayMqExchange() {
        return gatewayMqExchange;
    }

    public void setGatewayMqExchange(String gatewayMqExchange) {
        this.gatewayMqExchange = gatewayMqExchange;
    }

    public String getCache() {
        return cache;
    }

    public void setCache(String cache) {
        this.cache = cache;
    }

    public List<AuthAccountModel> getAccounts() {
        return accounts;
    }

    public void setAccounts(List<AuthAccountModel> accounts) {
        this.accounts = accounts;
    }
}
